package com.rxy.demo.controller;

import com.rxy.demo.pojo.DO.Goods;
import com.rxy.demo.pojo.VO.GoodsProviderVO;
import com.rxy.demo.service.CrudService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class CrudController {

    @Autowired
    private CrudService crudService;


    @PostMapping("/insert")
    public String insert(@RequestBody GoodsProviderVO goodsProviderVO){
        return crudService.insertGoodsProvider(goodsProviderVO);
    }

    @GetMapping("/findAll")
    public Object findAll(){
        return crudService.select();
    }


    @GetMapping("/delete")
    public String delete(Integer id){
        return crudService.delete(id);
    }


    @PostMapping("/update")
    public String update(@RequestBody GoodsProviderVO goodsProviderVO){
        return crudService.updateGoods(goodsProviderVO);
    }

    @GetMapping("/pageFind")
    public List<Goods> pageFind(){
        return crudService.pageFind(1,2);
    }
}
